﻿// =====================================================    
// Author: hexid26
// Email : hexid26@outlook.com
// Date  : 2015/07/06
// This code is for sharing
// Copyright (C)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ToukidenKiwamiAssist
{
    public partial class InputForm : Form
    {
        public string[] rt = new string[2] { "", "" };

        public InputForm(int x, int y)
        {
            InitializeComponent();
            //this.btnOK.DialogResult = DialogResult.OK;
            if (x == -1 && y == -1)
            {
                this.StartPosition = FormStartPosition.CenterParent;
            }
            else
            {
                this.Left = x;
                this.Top = y;
            }
        }

        public InputForm(string str1, string str2, int x, int y)
        {
            InitializeComponent();
            //this.btnOK.DialogResult = DialogResult.OK;
            textBoxName.Text = str1;
            textBoxDescrpt.Text = str2;
            if (x == -1 && y == -1)
            {
                this.StartPosition = FormStartPosition.CenterParent;
            }
            else
            {
                this.Left = x;
                this.Top = y;
            }

        }

        public InputForm()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (textBoxName.Text.Equals(""))
            {
                MessageBox.Show("必须起个名字吧！");
            }
            else
            {
                this.DialogResult = DialogResult.OK;
                rt[0] = textBoxName.Text;
                rt[1] = textBoxDescrpt.Text;
                this.Dispose();
            }
        }

        private void textBoxName_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                SendKeys.Send("{tab}");
            }
        }
    }
}
